<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="专辑ID" prop="albumId">
        <el-input v-model="queryParams.albumId" placeholder="请输入专辑ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="专辑名称" prop="albumName">
        <el-input v-model="queryParams.albumName" placeholder="请输入专辑ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="剧集ID" prop="episodeId">
        <el-input v-model="queryParams.episodeId" placeholder="请输入剧集ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="剧集名称" prop="episodeName">
        <el-input v-model="queryParams.episodeName" placeholder="请输入剧集名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="原剧集ID" prop="sourceId">
        <el-input v-model="queryParams.sourceId" placeholder="请输入剧集ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="episodeResourceStreamList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="专辑ID" align="center" prop="albumId" width="180" />
      <el-table-column label="专辑名称" align="center" prop="albumName" width="180" />
      <el-table-column label="剧集ID" align="center" prop="episodeId" width="180" />
      <el-table-column label="剧集名称" align="center" prop="episodeName" width="180" />
      <el-table-column label="剧集排序" align="center" prop="episodeOrder" width="80" />
      <el-table-column label="原剧集ID" align="center" prop="sourceId" width="180" />
      <el-table-column label="码流状态" align="center" prop="status" width="180" />
      <el-table-column label="CP状态" align="center" prop="cpStatus" width="180" />
      <el-table-column label="注入状态" align="center" prop="injectStatus" width="180" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="160" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">

        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import { selectWithEpisodeListPage } from "@/api/jishiting/media";

export default {
  name: "Notice",
  dicts: [],
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 剧集数据
      episodeResourceStreamList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        albumId: undefined,
        episodeId: undefined,
        sourceId: undefined,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() { },
  methods: {
    /** 查询公告列表 */
    getList() {
      this.loading = true;
      selectWithEpisodeListPage(this.queryParams)
        .then((response) => {
          this.episodeResourceStreamList = response.data;
          this.total = response.total;
          this.loading = false;
        })
        .catch((error) => {
          this.loading = false;
        });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        albumId: undefined,
        albumName: undefined,
        episodeId: undefined,
        episodeName: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
  },
};
</script>
